Skip to content

Enforce in bootstrap that doc must have stage at least 1 #145011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 11, 2025

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Aug 6, 2025

Following with the bootstrap cleanups, this time around doc steps. Should be pretty straightforward, because the supporting infrastructure was already there.

The only thing I found a bit fishy is using Mode::ToolBootstrap as a "catch-all" mode for non-rustc-private steps in tool_doc!, but I don't think that we need to distinguish the tools in some special way when documenting them, apart from supporting rustc_private.

Before, x doc more or less defaulted to what we call stage 2 now. Now it is properly stage 1, so e.g. x doc compiler documents the compiler using the stage0/beta rust(do)c.

r? @jieyouxu

try-job: dist-aarch64-msvc

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Aug 6, 2025
@bors
Copy link
Collaborator

bors commented Aug 7, 2025

☔ The latest upstream changes (presumably #145020) made this pull request unmergeable. Please resolve the merge conflicts.

@Kobzol Kobzol marked this pull request as ready for review August 8, 2025 06:17
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 8, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@Kobzol
Copy link
Member Author

Kobzol commented Aug 8, 2025

Rebased over the two merged PRs, should be ready now.

@rustbot ready

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! The changes look good in the general sense that it does feel more self-consistent. I do have some questions though that occurred to me when looking at the changes.

Comment on lines 1744 to +1988
#[test]
#[should_panic]
fn doc_compiler_stage_0() {
let ctx = TestCtx::new();
insta::assert_snapshot!(
ctx.config("doc")
.path("compiler")
.stage(0)
.render_steps(), @r"
[build] rustdoc 0 <host>
[build] llvm <host>
[doc] rustc 0 <host>
");
ctx.config("doc").path("compiler").stage(0).run();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: hm, would we regress any actual use cases of documenting the stage 0 compiler?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't document the stage 0 compiler, because we don't have its source code. My mental model around this looks like this:

  • Every stage has two components attached to it: sources and artifacts.
  • We do not have the source of stage 0 available.
  • When we do check/clippy/build/doc, we always work with sources, not artifacts, so it makes no sense for it to work on stage 0.
  • When we do test, we work with artifacts, so it makes sense (in niche scenarios) to also run it on stage 0.

Copy link
Member

@jieyouxu jieyouxu Aug 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that makes sense 👍. I.e. source-availability vs artifact-availability.

Comment on lines +979 to +990
// Build rustc docs so that we generate relative links.
run.builder.ensure(Rustc::from_build_compiler(run.builder, compilers.build_compiler(), target));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: hah, this is not super obvious...

Comment on lines +1178 to +1195
[doc] rustc 2 <host> -> std 2 <host> crates=[]
[doc] rustc 2 <host> -> std 2 <target1> crates=[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: hm, this is always a bit funny, when we run a std doc step with

crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]

but then again later with

crates=[]

then I think we rely on the fact that they can unify to not have this invalidate the previous build cache (?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. I did some experiments with x clippy compiler steps with and without unification and it looked like the cache is not being broken, but we'll see I guess.

Comment on lines +1207 to +1228
[doc] book (book) <host>
[doc] book/first-edition (book) <host>
[doc] book/second-edition (book) <host>
[doc] book/2018-edition (book) <host>
[build] rustdoc 1 <host>
[doc] rustc 1 <host> -> standalone 2 <host>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: wait, are we building less than we should be? I.e. there are two hosts, $\text{host}_{1} := \text{"host"}$ and $\text{host}_{1} := \text{"TEST-TRIPLE-1"}$. Or is this an instance where the "host" is actually the build platform and not actually the host platform? I.e. under the scenario where bootstrap is ran on a different platform than where the stage 1 compiler would be ran (?)

Hm... or taking a step back, what does the "hosts" config actually mean in bootstrap?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very good question 😆 When you specify hosts, you will essentially override the default host build target, see this:

config.hosts = if let Some(TargetSelectionList(arg_host)) = flags_host {

In terms of what hosts means, the documentation is here:

hosts: Vec<TargetSelection>,
. hosts determines for what targets we should build host tools, while targets determines for what targets we should build the stdlib.

But yeah, it's super confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, I think I asked you about this once already, but I keep forgetting the actual distinction.

@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Aug 10, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 10, 2025
@bors
Copy link
Collaborator

bors commented Aug 10, 2025

📌 Commit 8b4d941 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2025
@bors
Copy link
Collaborator

bors commented Aug 11, 2025

⌛ Testing commit 8b4d941 with merge a6620a4...

@bors
Copy link
Collaborator

bors commented Aug 11, 2025

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing a6620a4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 11, 2025
@bors bors merged commit a6620a4 into rust-lang:master Aug 11, 2025
12 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 11, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 53af067 (parent) -> a6620a4 (this PR)

Test differences

Show 7 test diffs

Stage 0

  • core::builder::tests::snapshot::build_compiler_lld_opt_in: [missing] -> pass (J0)
  • core::builder::tests::snapshot::doc_reference: [missing] -> pass (J0)
  • core::builder::tests::snapshot::test_lld_opt_in: pass -> [missing] (J0)

Additionally, 4 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard a6620a45bd29575cce67b6a0ab2956aef105e324 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-2: 2651.2s -> 4054.2s (52.9%)
  2. dist-apple-various: 4077.2s -> 6062.0s (48.7%)
  3. dist-aarch64-linux: 5532.0s -> 8017.3s (44.9%)
  4. x86_64-apple-2: 5299.8s -> 3660.4s (-30.9%)
  5. aarch64-apple: 8935.9s -> 6582.2s (-26.3%)
  6. x86_64-apple-1: 9952.6s -> 8142.2s (-18.2%)
  7. pr-check-1: 1702.0s -> 1448.2s (-14.9%)
  8. aarch64-gnu-llvm-19-2: 2511.1s -> 2200.1s (-12.4%)
  9. i686-gnu-1: 8311.9s -> 7430.5s (-10.6%)
  10. x86_64-gnu-llvm-19: 2756.6s -> 2468.1s (-10.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a6620a4): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -3.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-3.6%, -3.1%] 2
All ❌✅ (primary) - - 0

Cycles

Results (secondary 3.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.3% [2.8%, 4.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 463.403s -> 464.586s (0.26%)
Artifact size: 377.34 MiB -> 377.31 MiB (-0.01%)

bors added a commit that referenced this pull request Aug 11, 2025
Enable RUST_BACKTRACE=1 on CI

We should really see the backtrace if something in bootstrap fails on CI. #145011 (comment) doesn't show many details.
@Kobzol
Copy link
Member Author

Kobzol commented Aug 11, 2025

Hmm, the pr-check-2 regression looks genuine, I'll investigate.

@Kobzol
Copy link
Member Author

Kobzol commented Aug 11, 2025

#145253 should fix it.

@lolbinarycat
Copy link
Contributor

e.g. x doc compiler documents the compiler using the stage0/beta rust(do)c.

So the previous meaning of stage1 (build rustdoc with current source and beta compiler) has been erased?

This would be a pretty big change, eliminating certain workflows but also meaning the cfg(bootstrap) will never need to be used in rustdoc, and making synchronized changes between rustdoc and libtest will be much easier.

cc @GuillaumeGomez Does this unblock any of your PRs?

@Kobzol
Copy link
Member Author

Kobzol commented Aug 11, 2025

So the previous meaning of stage1 (build rustdoc with current source and beta compiler) has been erased?

Could you please clarify what do you mean by "previous meaning of stage1"?

This PR shouldn't really make any large changes to rustdoc workflow. It just makes staging of doc steps consistent with the rest of bootstrap; after the stage 0 redesign, most steps were inconsistent and still living in pre-stage0-redesign world.

@GuillaumeGomez
Copy link
Member

I think @lolbinarycat is talking about the libtest blockers on my PRs. And no, I think it's unrelated.

@lolbinarycat
Copy link
Contributor

right, because x doc --stage 1 and x test --stage 1 don't actually use the same rustdoc... hm.

@Kobzol
Copy link
Member Author

Kobzol commented Aug 11, 2025

I still have to get to fixing test steps, so far I mostly fixed build, check, tools, doc, codegen backends and now working on Clippy. Then I'll work on dist and test and it should be mostly done.

fmease added a commit to fmease/rust that referenced this pull request Aug 11, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? `@jieyouxu`
fmease added a commit to fmease/rust that referenced this pull request Aug 12, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? ``@jieyouxu``
fmease added a commit to fmease/rust that referenced this pull request Aug 12, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? ```@jieyouxu```
fmease added a commit to fmease/rust that referenced this pull request Aug 12, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? ````@jieyouxu````
fmease added a commit to fmease/rust that referenced this pull request Aug 12, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? `````@jieyouxu`````
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 12, 2025
…ieyouxu

Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-rust-lang#145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? ``````@jieyouxu``````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants